﻿// -----------------------------------------------------------------------
// <copyright file="File.cs" company="Company">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.AccessControl;
using System.Text;
using Company.IO.Interfaces;
using FileAccess = Company.IO.Interfaces.FileAccess;
using FileAttributes = Company.IO.Interfaces.FileAttributes;
using FileMode = Company.IO.Interfaces.FileMode;
using FileOptions = Company.IO.Interfaces.FileOptions;
using FileShare = Company.IO.Interfaces.FileShare;

namespace Company.System.IO
{
    /// <summary>
    /// Exposes methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
    /// </summary>
    [Guid("d6db1254-0619-41b7-8bce-76c5f5825da8")]
    public class File : IFile
    {
        /// <summary>
        /// Initializes a new instance of the File class
        /// </summary>
        public File()
            : this(new SystemIoConverter())
        {
        }

        /// <summary>
        /// Initializes a new instance of the File class
        /// </summary>
        /// <param name="systemIoConverter">The ISystemConverzter to use</param>
        [DebuggerHidden]
        public File(ISystemIoConverter systemIoConverter)
        {
            IoConverter = systemIoConverter;
        }

        /// <summary>
        /// Get or set the converter
        /// </summary>
        private ISystemIoConverter IoConverter { get; set; }

        #region Implementation of IFile

        /// <summary>
        /// Opens an existing UTF-8 encoded text file for reading.
        /// </summary>
        /// <param name="path">The file to be opened for reading.</param>
        /// <returns>A IStreamReader on the specified path.</returns>
        /// <exception cref="UnauthorizedAccessException">The caller does not have the required permission.</exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStreamReader IFile.OpenText(string path)
        {
            return Convert(global::System.IO.File.OpenText(path));
        }

        /// <summary>
        /// Creates or opens a file for writing UTF-8 encoded text.
        /// </summary>
        /// <param name="path">The file to be opened for writing.</param>
        /// <returns>A IStreamWriter that writes to the specified file using UTF-8 encoding.</returns>
        /// <exception cref="UnauthorizedAccessException">The caller does not have the required permission.</exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStreamWriter IFile.CreateText(string path)
        {
            return Convert(global::System.IO.File.CreateText(path));
        }

        /// <summary>
        /// Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
        /// </summary>
        /// <param name="path">The path to the file to append to.</param>
        /// <returns>A IStreamWriter that appends UTF-8 encoded text to an existing file.</returns>
        /// <exception cref="UnauthorizedAccessException">The caller does not have the required permission.</exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStreamWriter IFile.AppendText(string path)
        {
            return Convert(global::System.IO.File.AppendText(path));
        }

        /// <summary>
        /// Copies an existing file to a new file. Overwriting a file of the same name is not allowed.
        /// </summary>
        /// <param name="sourceFileName">The file to copy.</param>
        /// <param name="destFileName">The name of the destination file. This cannot be a directory or an existing file.</param>
        /// <exception cref="UnauthorizedAccessException">The caller does not have the required permission.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.Copy(string sourceFileName, string destFileName)
        {
            global::System.IO.File.Copy(sourceFileName, destFileName);
        }

        /// <summary>
        /// Copies an existing file to a new file. Overwriting a file of the same name is allowed.
        /// </summary>
        /// <param name="sourceFileName">The file to copy.</param>
        /// <param name="destFileName">The name of the destination file. This cannot be a directory.</param>
        /// <param name="overwrite">true if the destination file can be overwritten; otherwise, false.</param>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">sourceFileName or destFileName is in an invalid format.</exception>
        void IFile.Copy(string sourceFileName, string destFileName, bool overwrite)
        {
            global::System.IO.File.Copy(sourceFileName, destFileName, overwrite);
        }

        /// <summary>
        /// Creates or overwrites a file in the specified path. 
        /// </summary>
        /// <param name="path">The path and name of the file to create. </param>
        /// <returns>A FileStream that provides read/write access to the file specified in path.</returns>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">sourceFileName or destFileName is in an invalid format.</exception>
        IStream IFile.Create(string path)
        {
            return Convert(global::System.IO.File.Create(path));
        }

        /// <summary>
        /// Creates or overwrites a file in the specified path. 
        /// </summary>
        /// <param name="path">The path and name of the file to create. </param>
        /// <param name="bufferSize">The number of bytes buffered for reads and writes to the file.</param>
        /// <returns>A FileStream with the specified buffer size that provides read/write access to the file specified in path.</returns>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">sourceFileName or destFileName is in an invalid format.</exception>
        IStream IFile.Create(string path, int bufferSize)
        {
            return Convert(global::System.IO.File.Create(path, bufferSize));
        }

        /// <summary>
        /// Creates or overwrites the specified file, specifying a buffer size and a FileOptions value that describes how to create or overwrite the file.  
        /// </summary>
        /// <param name="path">The path and name of the file to create. </param>
        /// <param name="bufferSize">The number of bytes buffered for reads and writes to the file.</param>
        /// <param name="options">One of the FileOptions values that describes how to create or overwrite the file.</param>
        /// <returns>A new file with the specified buffer size.</returns>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">sourceFileName or destFileName is in an invalid format.</exception>
        IStream IFile.Create(string path, int bufferSize, FileOptions options)
        {
            return Convert(global::System.IO.File.Create(path, bufferSize, Convert(options)));
        }

        /// <summary>
        /// Creates or overwrites the specified file, specifying a buffer size and a FileOptions value that describes how to create or overwrite the file.  
        /// </summary>
        /// <param name="path">The path and name of the file to create. </param>
        /// <param name="bufferSize">The number of bytes buffered for reads and writes to the file.</param>
        /// <param name="options">One of the FileOptions values that describes how to create or overwrite the file.</param>
        /// <param name="fileSecurity">One of the FileSecurity values that determines the access control and audit security for the file.</param>
        /// <returns>A new file with the specified buffer size, file options, and file security.</returns>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">
        /// <para>destFileName exists.</para>
        /// <para>- or -</para>
        /// <para>An I/O error has occurred.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">sourceFileName or destFileName is in an invalid format.</exception>
        IStream IFile.Create(string path, int bufferSize, FileOptions options, FileSecurity fileSecurity)
        {
            return Convert(global::System.IO.File.Create(path, bufferSize, Convert(options), fileSecurity));
        }

        /// <summary>
        /// Deletes the specified file. An exception is not thrown if the specified file does not exist. 
        /// </summary>
        /// <param name="path">The name of the file to be deleted. </param>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The caller does not have the required permission.</para>
        /// <para>- or -</para>
        /// <para>destFileName is read-only.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// <para>- or -</para>
        /// <para>sourceFileName or destFileName specifies a directory.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="IIOException">The specified file is in use. </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.Delete(string path)
        {
            global::System.IO.File.Delete(path);
        }

        /// <summary>
        /// Decrypts a file that was encrypted by the current account using the Encrypt method. 
        /// </summary>
        /// <param name="path">A path that describes a file to decrypt.</param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// The path parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IDriveNotFoundException">An invalid drive was specified.</exception>
        /// <exception cref="IFileNotFoundException">The file described by the path parameter could not be found.</exception>
        /// <exception cref="IIOException">
        /// <para>An I/O error occurred while opening the file. For example, the encrypted file is already open.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
        /// <exception cref="NotSupportedException">The file system is not NTFS.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The path parameter specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>The path parameter specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        void IFile.Decrypt(string path)
        {
            global::System.IO.File.Decrypt(path);
        }

        /// <summary>
        /// Encrypts a file so that only the account used to encrypt the file can decrypt it. 
        /// </summary>
        /// <param name="path">A path that describes a file to encrypt.</param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// The path parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IDriveNotFoundException">An invalid drive was specified.</exception>
        /// <exception cref="IFileNotFoundException">The file described by the path parameter could not be found.</exception>
        /// <exception cref="IIOException">
        /// <para>An I/O error occurred while opening the file. For example, the encrypted file is already open.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
        /// <exception cref="NotSupportedException">The file system is not NTFS.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The path parameter specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>The path parameter specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        void IFile.Encrypt(string path)
        {
            global::System.IO.File.Encrypt(path);
        }

        /// <summary>
        /// Determines whether the specified file exists.
        /// </summary>
        /// <param name="path">The file to check.</param>
        /// <returns>
        /// true if the caller has the required permissions and path contains the name of an existing file; otherwise, false. 
        /// This method also returns false if path is a null reference (Nothing in Visual Basic), an invalid path, or a zero-length string. 
        /// If the caller does not have sufficient permissions to read the specified file, 
        /// no exception is thrown and the method returns false regardless of the existence of path. 
        /// </returns>
        bool IFile.Exists(string path)
        {
            return global::System.IO.File.Exists(path);
        }

        /// <summary>
        /// Opens a IStream on the specified path with read/write access. 
        /// </summary>
        /// <param name="path">The file to open.</param>
        /// <param name="mode">
        /// A FileMode value that specifies whether a file is created if one does not exist, 
        /// and determines whether the contents of existing files are retained or overwritten.
        /// </param>
        /// <returns>A FileStream opened in the specified mode and path, with read/write access and not shared.</returns>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The path parameter specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>The path parameter specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">mode specified an invalid value.</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStream IFile.Open(string path, FileMode mode)
        {
            return Convert(global::System.IO.File.Open(path, Convert(mode)));
        }

        /// <summary>
        /// Opens a IStream on the specified path with read/write access. 
        /// </summary>
        /// <param name="path">The file to open.</param>
        /// <param name="mode">
        /// A FileMode value that specifies whether a file is created if one does not exist, 
        /// and determines whether the contents of existing files are retained or overwritten.
        /// </param>
        /// <param name="access">A FileAccess value that specifies the operations that can be performed on the file. </param>
        /// <returns>An unshared FileStream that provides access to the specified file, with the specified mode and access.</returns>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The path parameter specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>The path parameter specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">mode specified an invalid value.</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStream IFile.Open(string path, FileMode mode, FileAccess access)
        {
            return Convert(global::System.IO.File.Open(path, Convert(mode), Convert(access)));
        }

        /// <summary>
        /// Opens a IStream on the specified path with read/write access. 
        /// </summary>
        /// <param name="path">The file to open.</param>
        /// <param name="mode">
        /// A FileMode value that specifies whether a file is created if one does not exist, 
        /// and determines whether the contents of existing files are retained or overwritten.
        /// </param>
        /// <param name="access">A FileAccess value that specifies the operations that can be performed on the file. </param>
        /// <param name="share">A FileShare value specifying the type of access other threads have to the file.</param>
        /// <returns>
        /// A FileStream on the specified path, having the specified mode with read, write, 
        /// or read/write access and the specified sharing option. 
        /// </returns>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The path parameter specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>The path parameter specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">mode specified an invalid value.</exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStream IFile.Open(string path, FileMode mode, FileAccess access, FileShare share)
        {
            return Convert(global::System.IO.File.Open(path, Convert(mode), Convert(access), Convert(share)));
        }

        /// <summary>
        /// Sets the date and time the file was created.
        /// </summary>
        /// <param name="path">The file for which to set the creation date and time information.</param>
        /// <param name="creationTime">A DateTime containing the value to set for the creation date and time of path. This value is expressed in local time.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetCreationTime(string path, DateTime creationTime)
        {
            global::System.IO.File.SetCreationTime(path, creationTime);
        }

        /// <summary>
        /// Sets the date and time, in coordinated universal time (UTC), that the file was created.
        /// </summary>
        /// <param name="path">The file for which to set the creation date and time information.</param>
        /// <param name="creationTimeUtc">
        /// A DateTime containing the value to set for the creation date and time of path. This value is expressed in UTC time.
        /// </param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetCreationTimeUtc(string path, DateTime creationTimeUtc)
        {
            global::System.IO.File.SetCreationTimeUtc(path, creationTimeUtc);
        }

        /// <summary>
        /// Returns the creation date and time of the specified file or directory.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain creation date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the creation date and time for the specified file or directory. This value is expressed in local time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetCreationTime(string path)
        {
            return global::System.IO.File.GetCreationTime(path);
        }

        /// <summary>
        /// Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain creation date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the creation date and time for the specified file or directory. This value is expressed in local time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetCreationTimeUtc(string path)
        {
            return global::System.IO.File.GetCreationTimeUtc(path);
        }

        /// <summary>
        /// Sets the date and time the specified file was last accessed.
        /// </summary>
        /// <param name="path">The file for which to set the access date and time information.</param>
        /// <param name="lastAccessTime">A DateTime containing the value to set for the last access date and time of path. This value is expressed in local time.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetLastAccessTime(string path, DateTime lastAccessTime)
        {
            global::System.IO.File.SetLastAccessTime(path, lastAccessTime);
        }

        /// <summary>
        /// Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.
        /// </summary>
        /// <param name="path">The file for which to set the access date and time information.</param>
        /// <param name="lastAccessTimeUtc">
        /// A DateTime containing the value to set for the last access date and time of path. This value is expressed in UTC time.
        /// </param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
        {
            global::System.IO.File.SetLastAccessTimeUtc(path, lastAccessTimeUtc);
        }

        /// <summary>
        /// Returns the date and time the specified file or directory was last accessed.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain access date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the date and time that the specified file or directory was last accessed. This value is expressed in local time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetLastAccessTime(string path)
        {
            return global::System.IO.File.GetLastAccessTime(path);
        }

        /// <summary>
        /// Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain access date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetLastAccessTimeUtc(string path)
        {
            return global::System.IO.File.GetLastAccessTimeUtc(path);
        }

        /// <summary>
        /// Sets the date and time that the specified file was last written to.
        /// </summary>
        /// <param name="path">The file for which to set the date and time information.</param>
        /// <param name="lastWriteTime">A DateTime containing the value to set for the last write date and time of path. This value is expressed in local time.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetLastWriteTime(string path, DateTime lastWriteTime)
        {
            global::System.IO.File.SetLastWriteTime(path, lastWriteTime);
        }

        /// <summary>
        /// Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.
        /// </summary>
        /// <param name="path">The file for which to set the date and time information.</param>
        /// <param name="lastWriteTimeUtc">A DateTime containing the value to set for the last write date and time of path. This value is expressed in UTC time.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
        {
            global::System.IO.File.SetLastWriteTimeUtc(path, lastWriteTimeUtc);
        }

        /// <summary>
        /// Returns the date and time the specified file or directory was last written to.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain write date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the date and time that the specified file or directory was last written to. This value is expressed in local time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetLastWriteTime(string path)
        {
            return global::System.IO.File.GetLastWriteTime(path);
        }

        /// <summary>
        /// Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
        /// </summary>
        /// <param name="path">The file or directory for which to obtain write date and time information.</param>
        /// <returns>
        /// A DateTime structure set to the date and time that the specified file or directory was last written to. This value is expressed in UTC time.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        DateTime IFile.GetLastWriteTimeUtc(string path)
        {
            return global::System.IO.File.GetLastWriteTimeUtc(path);
        }

        /// <summary>
        /// Gets the FileAttributes of the file on the path.
        /// </summary>
        /// <param name="path">The path to the file.</param>
        /// <returns>
        /// The FileAttributes of the file on the path.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        FileAttributes IFile.GetAttributes(string path)
        {
            return Convert(global::System.IO.File.GetAttributes(path));
        }

        /// <summary>
        /// Sets the specified FileAttributes of the file on the specified path.
        /// </summary>
        /// <param name="path">The path to the file.</param>
        /// <param name="fileAttributes">A bitwise combination of the enumeration values.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetAttributes(string path, FileAttributes fileAttributes)
        {
            global::System.IO.File.SetAttributes(path, Convert(fileAttributes));
        }

        /// <summary>
        /// Gets a FileSecurity object that encapsulates the access control list (ACL) entries for a specified file.
        /// </summary>
        /// <param name="path">The path to a file containing a FileSecurity object that describes the file's access control list (ACL) information.</param>
        /// <returns>
        /// A FileSecurity object that encapsulates the access control rules for the file described by the path parameter.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        FileSecurity IFile.GetAccessControl(string path)
        {
            return global::System.IO.File.GetAccessControl(path);
        }

        /// <summary>
        /// Gets a FileSecurity object that encapsulates the specified type of access control list (ACL) entries for a particular file.
        /// </summary>
        /// <param name="path">
        /// The path to a file containing a FileSecurity object that describes the file's access control list (ACL) information.
        /// </param>
        /// <param name="includeSections">One of the AccessControlSections values that specifies the type of access control list (ACL) information to receive.</param>
        /// <returns>
        /// A FileSecurity object that encapsulates the access control rules for the file described by the path parameter.
        /// </returns>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// path is null. 
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// path is in an invalid format.
        /// </exception>
        FileSecurity IFile.GetAccessControl(string path, AccessControlSections includeSections)
        {
            return global::System.IO.File.GetAccessControl(path, includeSections);
        }

        /// <summary>
        /// Applies access control list (ACL) entries described by a FileSecurity object to the specified file.
        /// </summary>
        /// <param name="path">A file to add or remove access control list (ACL) entries from.</param>
        /// <param name="fileSecurity">A FileSecurity object that describes an ACL entry to apply to the file described by the path parameter.</param>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IIOException">An I/O error occurred while performing the operation.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// creationTime specifies a value outside the range of dates, times, or both permitted for this operation.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        void IFile.SetAccessControl(string path, FileSecurity fileSecurity)
        {
            global::System.IO.File.SetAccessControl(path, fileSecurity);
        }

        /// <summary>
        /// Opens an existing file for reading.
        /// </summary>
        /// <param name="path">The file to be opened for reading.</param>
        /// <returns>A read-only IStream on the specified path.</returns>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStream IFile.OpenRead(string path)
        {
            return Convert(global::System.IO.File.OpenRead(path));
        }

        /// <summary>
        /// Opens an existing file or creates a new file for writing.
        /// </summary>
        /// <param name="path">The file to be opened for writing.</param>
        /// <returns>An unshared IStream object on the specified path with Write access.</returns>
        /// <exception cref="IFileNotFoundException">The specified path was not found.</exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The path parameter is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive).</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// The caller does not have the required permission.
        /// </exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        IStream IFile.OpenWrite(string path)
        {
            return Convert(global::System.IO.File.OpenWrite(path));
        }

        /// <summary>
        /// Opens a text file, reads all lines of the file, and then closes the file.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <returns>A string containing all lines of the file.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        string IFile.ReadAllText(string path)
        {
            return global::System.IO.File.ReadAllText(path);
        }

        /// <summary>
        /// Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <param name="encoding">The encoding applied to the contents of the file.</param>
        /// <returns>A string containing all lines of the file.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        string IFile.ReadAllText(string path, Encoding encoding)
        {
            return global::System.IO.File.ReadAllText(path, encoding);
        }

        /// <summary>
        /// Creates a new file, writes the specified string to the file, and then closes the file. 
        /// If the target file already exists, it is overwritten.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <param name="contents">The string to write to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllText(string path, string contents)
        {
            global::System.IO.File.WriteAllText(path, contents);
        }

        /// <summary>
        /// Creates a new file, writes the specified string to the file, and then closes the file. 
        /// If the target file already exists, it is overwritten.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <param name="contents">The string to write to the file.</param>
        /// <param name="encoding">The encoding to apply to the string.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllText(string path, string contents, Encoding encoding)
        {
            global::System.IO.File.WriteAllText(path, contents, encoding);
        }

        /// <summary>
        /// Opens a binary file, reads the contents of the file into a byte array, and then closes the file.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <returns>A byte array containing the contents of the file.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        byte[] IFile.ReadAllBytes(string path)
        {
            return global::System.IO.File.ReadAllBytes(path);
        }

        /// <summary>
        /// Creates a new file, writes the specified byte array to the file, and then closes the file. 
        /// If the target file already exists, it is overwritten.
        /// </summary>
        /// <param name="path">The file to write to.</param>
        /// <param name="bytes">The bytes to write to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllBytes(string path, byte[] bytes)
        {
            global::System.IO.File.WriteAllBytes(path, bytes);
        }

        /// <summary>
        /// Opens a text file, reads all lines of the file, and then closes the file.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <returns>A string array containing all lines of the file.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        string[] IFile.ReadAllLines(string path)
        {
            return global::System.IO.File.ReadAllLines(path);
        }

        /// <summary>
        /// Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
        /// </summary>
        /// <param name="path">The file to open for reading.</param>
        /// <param name="encoding">The encoding applied to the contents of the file.</param>
        /// <returns>A string array containing all lines of the file.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        string[] IFile.ReadAllLines(string path, Encoding encoding)
        {
            return global::System.IO.File.ReadAllLines(path, encoding);
        }

        /// <summary>
        /// Reads the lines of a file.
        /// </summary>
        /// <param name="path">The file to read.</param>
        /// <returns>All the lines of the file, or the lines that are the result of a query.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        IEnumerable<string> IFile.ReadLines(string path)
        {
            return global::System.IO.File.ReadLines(path);
        }

        /// <summary>
        /// Read the lines of a file that has a specified encoding.
        /// </summary>
        /// <param name="path">The file to read.</param>
        /// <param name="encoding">The encoding that is applied to the contents of the file.</param>
        /// <returns>All the lines of the file, or the lines that are the result of a query.</returns>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        IEnumerable<string> IFile.ReadLines(string path, Encoding encoding)
        {
            return global::System.IO.File.ReadLines(path, encoding);
        }

        /// <summary>
        /// Creates a new file, write the specified string array to the file, and then closes the file.
        /// </summary>
        /// <param name="path">The file to write to.</param>
        /// <param name="contents">The string array to write to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllLines(string path, string[] contents)
        {
            global::System.IO.File.WriteAllLines(path, contents);
        }

        /// <summary>
        /// Creates a new file, writes the specified string array to the file by using the specified encoding, and then closes the file. 
        /// </summary>
        /// <param name="path">The file to write to.</param>
        /// <param name="contents">The string array to write to the file.</param>
        /// <param name="encoding">An Encoding object that represents the character encoding applied to the string array.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllLines(string path, string[] contents, Encoding encoding)
        {
            global::System.IO.File.WriteAllLines(path, contents, encoding);
        }

        /// <summary>
        /// Creates a new file, writes a collection of strings to the file, and then closes the file.
        /// </summary>
        /// <param name="path">The file to write to.</param>
        /// <param name="contents">The lines to write to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllLines(string path, IEnumerable<string> contents)
        {
            global::System.IO.File.WriteAllLines(path, contents);
        }

        /// <summary>
        /// Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file. 
        /// </summary>
        /// <param name="path">The file to write to.</param>
        /// <param name="contents">The lines to write to the file.</param>
        /// <param name="encoding">The character encoding to use.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)
        {
            global::System.IO.File.WriteAllLines(path, contents, encoding);
        }

        /// <summary>
        /// Opens a file, appends the specified string to the file, and then closes the file. 
        /// If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.
        /// </summary>
        /// <param name="path">The file to append the specified string to.</param>
        /// <param name="contents">The string to append to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.AppendAllText(string path, string contents)
        {
            global::System.IO.File.AppendAllText(path, contents);
        }

        /// <summary>
        /// Appends the specified string to the file, creating the file if it does not already exist.
        /// </summary>
        /// <param name="path">The file to append the specified string to.</param>
        /// <param name="contents">The string to append to the file.</param>
        /// <param name="encoding">The character encoding to use.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.AppendAllText(string path, string contents, Encoding encoding)
        {
            global::System.IO.File.AppendAllText(path, contents, encoding);
        }

        /// <summary>
        /// Appends lines to a file, and then closes the file.
        /// </summary>
        /// <param name="path">The file to append the lines to. The file is created if it does not already exist.</param>
        /// <param name="contents">The lines to append to the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.AppendAllLines(string path, IEnumerable<string> contents)
        {
            global::System.IO.File.AppendAllLines(path, contents);
        }

        /// <summary>
        /// Appends lines to a file by using a specified encoding, and then closes the file.
        /// </summary>
        /// <param name="path">The file to append the lines to.</param>
        /// <param name="contents">The lines to append to the file.</param>
        /// <param name="encoding">The character encoding to use.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)
        {
            global::System.IO.File.AppendAllLines(path, contents, encoding);
        }

        /// <summary>
        /// Moves a specified file to a new location, providing the option to specify a new file name.
        /// </summary>
        /// <param name="sourceFileName">The name of the file to move.</param>
        /// <param name="destFileName">The new path for the file.</param>
        /// <exception cref="ArgumentException">
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
        /// </exception>
        /// <exception cref="ArgumentNullException">path is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>path specified a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>path specified a directory.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">The file specified in path was not found.</exception>
        /// <exception cref="NotSupportedException">path is in an invalid format.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.Move(string sourceFileName, string destFileName)
        {
            global::System.IO.File.Move(sourceFileName, destFileName);
        }

        /// <summary>
        /// Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file.
        /// </summary>
        /// <param name="sourceFileName">The name of a file that replaces the file specified by destinationFileName.</param>
        /// <param name="destinationFileName">The name of the file being replaced.</param>
        /// <param name="destinationBackupFileName">The name of the backup file.</param>
        /// <exception cref="ArgumentException">
        /// <para>The path described by the destinationFileName parameter was not of a legal form.</para>
        /// <para>- or -</para>
        /// <para>The path described by the destinationBackupFileName parameter was not of a legal form.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The destinationFileName parameter is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDriveNotFoundException">An invalid drive was specified.</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The sourceFileName or destinationFileName parameter specifies a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>Source or destination parameters specify a directory instead of a file.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">
        /// <para>The file described by the current FileInfo object could not be found.</para>
        /// <para>- or -</para>
        /// <para>The file described by the destinationBackupFileName parameter could not be found.</para>
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)
        {
            global::System.IO.File.Replace(sourceFileName, destinationFileName, destinationBackupFileName);
        }

        /// <summary>
        /// Replaces the contents of a specified file with the contents of another file, 
        /// deleting the original file, and creating a backup of the replaced file and optionally ignores merge errors.
        /// </summary>
        /// <param name="sourceFileName">The name of a file that replaces the file specified by destinationFileName.</param>
        /// <param name="destinationFileName">The name of the file being replaced.</param>
        /// <param name="destinationBackupFileName">The name of the backup file.</param>
        /// <param name="ignoreMetadataErrors">
        /// true to ignore merge errors (such as attributes and access control lists (ACLs)) from the replaced file to the replacement file; otherwise, false.
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>The path described by the destinationFileName parameter was not of a legal form.</para>
        /// <para>- or -</para>
        /// <para>The path described by the destinationBackupFileName parameter was not of a legal form.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">The destinationFileName parameter is null.</exception>
        /// <exception cref="IPathTooLongException">
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters.
        /// </exception>
        /// <exception cref="IDriveNotFoundException">An invalid drive was specified.</exception>
        /// <exception cref="IIOException">An I/O error occurred while opening the file.</exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>The sourceFileName or destinationFileName parameter specifies a file that is read-only.</para>
        /// <para>- or -</para>
        /// <para>This operation is not supported on the current platform.</para>
        /// <para>- or -</para>
        /// <para>Source or destination parameters specify a directory instead of a file.</para>
        /// <para>- or -</para>
        /// <para>The caller does not have the required permission.</para>
        /// </exception>
        /// <exception cref="IFileNotFoundException">
        /// <para>The file described by the current FileInfo object could not be found.</para>
        /// <para>- or -</para>
        /// <para>The file described by the destinationBackupFileName parameter could not be found.</para>
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.</exception>
        /// <exception cref="SecurityException">The caller does not have the required permission.</exception>
        void IFile.Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName,
                           bool ignoreMetadataErrors)
        {
            global::System.IO.File.Replace(sourceFileName, destinationFileName, destinationBackupFileName,
                                           ignoreMetadataErrors);
        }

        #endregion

        /// <summary>
        /// Converts the specified stream reader.
        /// </summary>
        /// <param name="streamReader">The stream reader.</param>
        /// <returns>The converted object</returns>
        private IStreamReader Convert(global::System.IO.StreamReader streamReader)
        {
            return IoConverter.Convert(streamReader);
        }

        /// <summary>
        /// Converts the specified stream writer.
        /// </summary>
        /// <param name="streamWriter">The stream writer.</param>
        /// <returns>The converted object</returns>
        private IStreamWriter Convert(global::System.IO.StreamWriter streamWriter)
        {
            return IoConverter.Convert(streamWriter);
        }

        /// <summary>
        /// Converts the specified file stream.
        /// </summary>
        /// <param name="fileStream">The file stream.</param>
        /// <returns>The converted object</returns>
        private IStream Convert(FileStream fileStream)
        {
            return IoConverter.Convert(fileStream);
        }

        /// <summary>
        /// Converts the specified options.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns>The converted object</returns>
        private global::System.IO.FileOptions Convert(FileOptions options)
        {
            return IoConverter.Convert(options);
        }

        /// <summary>
        /// Converts the specified mode.
        /// </summary>
        /// <param name="mode">The mode.</param>
        /// <returns>The converted object</returns>
        private global::System.IO.FileMode Convert(FileMode mode)
        {
            return IoConverter.Convert(mode);
        }

        /// <summary>
        /// Converts the specified access.
        /// </summary>
        /// <param name="access">The access.</param>
        /// <returns>The converted object</returns>
        private global::System.IO.FileAccess Convert(FileAccess access)
        {
            return IoConverter.Convert(access);
        }

        /// <summary>
        /// Converts the specified share.
        /// </summary>
        /// <param name="share">The share.</param>
        /// <returns>The converted object</returns>
        private global::System.IO.FileShare Convert(FileShare share)
        {
            return IoConverter.Convert(share);
        }

        /// <summary>
        /// Converts the specified file attributes.
        /// </summary>
        /// <param name="fileAttributes">The file attributes.</param>
        /// <returns>The converted object</returns>
        private FileAttributes Convert(global::System.IO.FileAttributes fileAttributes)
        {
            return IoConverter.Convert(fileAttributes);
        }

        /// <summary>
        /// Converts the specified file attributes.
        /// </summary>
        /// <param name="fileAttributes">The file attributes.</param>
        /// <returns>The converted object</returns>
        private global::System.IO.FileAttributes Convert(FileAttributes fileAttributes)
        {
            return IoConverter.Convert(fileAttributes);
        }
    }
}